using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Busi.Entity
{
	[Table("Dic_MeetingRoom", "ID", "Busi.ConnectionString")]
	public class Dic_MeetingRoom : Info
	{
		#region SQL column name consts 
		public const string SQLCOL_ID = "ID";
		public const string SQLCOL_PROPERTYID = "PropertyID";
		public const string SQLCOL_PROPERTYNAME = "PropertyName";
		public const string SQLCOL_PROPERTYDESC = "PropertyDesc";
		public const string SQLCOL_PROPERTYTYPE = "PropertyType";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public Dic_MeetingRoom () {}

		/// <summary>
		/// Construct entity by primary key, other fields will be assigned by 
		/// "Load" method.
		/// </summary>
		public Dic_MeetingRoom (int ID)
		{
			this.ID = ID;
		}
		#endregion

		public override void Init (DataRow row)
		{
			ID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ID]);
			PropertyID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROPERTYID]);
			PropertyName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_PROPERTYNAME]);
			PropertyDesc = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_PROPERTYDESC]);
			PropertyType = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_PROPERTYTYPE]);
		}

		#region Properties 
		#region Property <int> ID
		[Property("ID", 4, SqlDbType.Int, true, true)]
		public int ID 
		{
			get { return _ID; }
			set { _ID = value; }
		}
		private int _ID = int.MinValue;
		#endregion

		#region Property <int> PropertyID
		[Property("PropertyID", 4, SqlDbType.Int, false, false)]
		public int PropertyID 
		{
			get { return _PropertyID; }
			set { _PropertyID = value; }
		}
		private int _PropertyID = int.MinValue;
		#endregion

		#region Property <string> PropertyName
		[Property("PropertyName", 100, SqlDbType.NVarChar, false, false)]
		public string PropertyName 
		{
			get { return _PropertyName; }
			set { _PropertyName = value; }
		}
		private string _PropertyName = null;
		#endregion

		#region Property <string> PropertyDesc
		[Property("PropertyDesc", 200, SqlDbType.NVarChar, false, false)]
		public string PropertyDesc 
		{
			get { return _PropertyDesc; }
			set { _PropertyDesc = value; }
		}
		private string _PropertyDesc = null;
		#endregion

		#region Property <string> PropertyType
		[Property("PropertyType", 100, SqlDbType.NVarChar, false, false)]
		public string PropertyType 
		{
			get { return _PropertyType; }
			set { _PropertyType = value; }
		}
		private string _PropertyType = null;
		#endregion
		#endregion


		public bool LoadByIdentity(int ID)
		{
			return DataAccess.SelectByIdentity(this, Convert.ToInt64(ID));
		}


		public bool DeleteByIdentity()
		{
			return DataAccess.DeleteByIdentity(this);
		}
	}
}
